package com.hup.joystick.config;

import com.hup.joystick.service.JoystickServiceJna;
import com.hup.joystick.service.JoystickServiceMocker;
import com.hup.joystick.service.joystick.JoystickService;
import com.hup.utils.commons.start.AppIcon;
import com.hup.utils.commons.start.SimpleExitHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hugan
 * @date 2020/10/21
 */
@Configuration
public class BeanConfig {

    /**
     * 用于一般UI开发测试,不连接dll,返回模拟数据
     */
    public static boolean useJoystickMocker;

    @Bean
    public AppIcon appIcon() {
        return new AppIcon("/img/app_tray.png");
    }

    @Bean
    public SimpleExitHandler exitHandler() {
        return new SimpleExitHandler();
    }

    @Bean
    public JoystickService JoystickService() {
        return useJoystickMocker ? new JoystickServiceMocker() : new JoystickServiceJna();
    }

}
